package com.dfd.oauth2.rbac2.service.impl;

import com.dfd.oauth2.rbac2.domain.TbUser;
import com.dfd.oauth2.rbac2.mapper.TbUserMapper;
import com.dfd.oauth2.rbac2.service.TbUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

/*
 *文件名: TbUserServiceImpl
 *创建者: 东东
 *创建时间:2021/8/30 10:14
 *描述:
 */
@Service
public class TbUserServiceImpl implements TbUserService {
    @Autowired
    private TbUserMapper userMapper;

    /**
     * 通过用户名获取用户信息
     * @param username  用户名
     * @return
     */
    @Override
    public TbUser getByUsername(String username) {
        Example example = new Example(TbUser.class);
        example.createCriteria().andEqualTo("username", username);
        return userMapper.selectOneByExample(example);
    }
}
